#define _CRT_SECURE_NO_WARNINGS 1

#include"DList.h"

void test1(ListNode* head) {
	ListPushBack(head, 1);
	ListPushBack(head, 2);
	ListPushBack(head, 3);
	ListPushBack(head, 4);
	ListPushBack(head, 5);
	ListPopBack(head);
	ListPrint(head);

	ListPopBack(head);
	ListPrint(head);

	ListPopBack(head);
	ListPrint(head);

	ListPopBack(head);
	ListPrint(head);

	ListPopBack(head);
	ListPrint(head);

	ListPopBack(head);
	ListPrint(head);

}

void test2(ListNode* head) {
	ListPushBack(head, 1);
	ListPushBack(head, 2);
	ListPushBack(head, 3);
	ListPushBack(head, 4);
	ListPushBack(head, 5);
	ListPopFront(head);
	ListPrint(head);
}


void test3(ListNode* head) {
	ListPushBack(head, 1);
	ListPushBack(head, 2);
	ListPushBack(head, 3);
	ListPushBack(head, 4);
	ListPushBack(head, 5);
	ListFind(head, 2);
	ListFind(head, 7);
	ListPrint(head);
}

void test4(ListNode* head) {
	ListPushBack(head, 1);
	ListPushBack(head, 2);
	ListPushBack(head, 3);
	ListPushBack(head, 4);
	ListPushBack(head, 5);
	ListInsert(head, ListFind(head, 2), 10);
	ListInsert(head, ListFind(head, 1), 10);
	ListInsert(head, ListFind(head, 5), 10);
	ListInsert(head, ListFind(head, 6), 10);
	ListPrint(head);
}

void test5(ListNode* head) {
	ListPushBack(head, 1);
	ListPushBack(head, 2);
	ListPushBack(head, 3);
	ListPushBack(head, 4);
	ListPushBack(head, 5);
	ListErase(head, ListFind(head, 5));
	ListErase(head, ListFind(head, 1));
	ListErase(head, ListFind(head, 2));
	ListPrint(head);
}


int main()
{
	ListNode* head = ListCreate();
	//test1(head);
	//test2(head);
	//test3(head);
	//test4(head);
	test5(head);

	ListDestory(head);

	return 0;
}